package learning.thread;

public class Thread3 {
	public static void main(String[] args) {
		AnThread at1=new AnThread("Cat");
		AnThread at2=new AnThread("Mouse");
		Thread t1=new Thread(at1);
		Thread t2=new Thread(at2);
		t1.start();
		
		t2.start();
	}

}
class AnThread implements Runnable{
    String name;
//    int    m=0;
	public AnThread(String name) {
		super();
		this.name = name;
	}

	@Override
	public void run() {
        for (int i = 1; i <101; i++) {
			if(i%10==0){
				System.out.println(this.name+" has ran about " +i+" m");
				try {
					Thread.sleep(1000);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		} 		
	}
	
}